package com.coin.controller;

import com.coin.domain.Sms;
import com.coin.model.R;
import com.coin.service.SmsService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: 李 力
 * @Date: 2025/6/11
 * @Description: com.coin.controller
 * @version: 1.0
 */
@Api(tags = "sms短信发送平台")
@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private SmsService smsService;

    /**
     * @Description: 发送短信
     * @Author: 李 力
     * @Date: 2025/6/11
     * @Param:
     * @return: R
     */
    @GetMapping("/sendTo")
    @ApiOperation(value = "发送短信")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sms", value = "短信的json数据")
    })
    public R sendMsg(@RequestBody @Validated Sms sms) {
        boolean isOk = smsService.sendMsg(sms);
        return isOk ? R.ok() : R.fail("发送失败");
    }
}
